package SymbolTable;

import antlr.collections.*;

//////////////////////////////////////////////////////////////////////////
//// STPortEntry
/**

@author Ivan Jeukens
@version v 0.1 03/10/2001
*/
public class STPortEntry extends STEntry {
    
    public static final int UNDEF = 0;
    public static final int YES = 1;
    public static final int NO = 2;
    
    public STPortEntry(String name, int mode, AST node, int narray) {
        super(name, mode, node, narray);
    }

    ///////////////////////////////////////////////////////////////////
    ////                        public methods                     ////

    public boolean isInput() {
        if(_isInput == YES) return true;
        return false;
    }
    
    public boolean isOutput() {
        if(_isOutput == YES) return true;
        return false;
    }
    
    public boolean isDirectionDefined() {
        if(_isInput == UNDEF || _isOutput == UNDEF) return false;        
        return true;
    }
    
    public void setInput(boolean value) {
        if(value) {
            _isInput = YES;   
        }
        else {
            _isInput = NO;   
        }
    }
    
    public void setOutput(boolean value) {
        if(value) {            
            _isOutput = YES;
        }
        else {
            _isOutput = NO;   
        }
    }

    public String toString() {
        return new String("#STEntry " + getName() + " mode=" + _mode +
            " nArray = " + _narray + " isInput = " + _isInput + 
            " isOutput = " + _isOutput + " type = " + _type);
    }

    ///////////////////////////////////////////////////////////////////
    ////                        private variables                  ////
         
    private int _isOutput;
    private int _isInput;                 
}
